import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

//defineStore 定义一个全局模块
//counter 模块名称
export const useCounterStore = defineStore('counter', () => {
  
  //全局状态
  const count=ref(100)
 

  //全局状态中的计算属性
  const doubleCount = computed(() => count.value * 2)
  
  //修改全局状态的方法
  function increment() {
    count.value++
  }

  return { count, doubleCount, increment }
})
